package com.letv.so.service.impl;

import java.util.Collection;
import java.util.Map;

import com.letv.mms.cache.factory.CacheFactory;
import com.letv.so.service.CacheService;

public class SoCacheClientServiceImpl<T> implements CacheService<T> {

    public T get(String key) {
        try {
            return (T) CacheFactory.getCache().get(key, null);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public Map<String, T> getMulti(Collection<String> keys) {

        return getMulti((String[]) keys.toArray());
    }

    public Map<String, T> getMulti(String[] keys) {

        try {
            return (Map<String, T>) CacheFactory.getCache().getMulti(keys, null);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
